<template>
	<view class="userLayout pageBg">
		<view :style="{height:getNavBarHeight() + 'px'}"></view>
		<view class="userInfo">
			
			<!-- 头像 -->
			<view class="avatar">
				<image src="../../static/logo.png" mode=""></image>
			</view>
			
			<!-- 名字或者ip -->
			<view class="ip">192.168.188.122</view>
			
			<!-- 归属地 -->
			<view class="address">来自于：中国</view>
			
			
		</view>
		
		<view class="section">
			<view class="list">
				<navigator url="/pages/classlist/classlist">
				<view class="row" v-for="item in listTop" :key="item.id">
					
					<view class="left">
						<uni-icons :type="item.imgPath" size="20" color="#28b389"></uni-icons>
						<view class="text">{{item.name}}</view>
					</view>
					
					<view class="right">
						<view class="text">{{item.tag}}</view>
						<uni-icons type="right" size="15" color="aaa"></uni-icons>
					</view>
					
				</view>
				</navigator>
			</view>
		</view>
		
		<view class="section">
			<view class="list">
				<view class="row" v-for="item in listButtom" :key="item.id">
					
					<view class="left">
						<uni-icons :type="item.imgPath" size="20" color="#28b389"></uni-icons>
						<view class="text">{{item.name}}</view>
					</view>
					
					<view class="right">
						<view class="text">{{item.tag}}</view>
						<uni-icons type="right" size="15" color="aaa"></uni-icons>
					</view>
					
				</view>
			</view>
		</view>
		
	</view>
</template>

<script setup>
import { ref } from 'vue';
import { getNavBarHeight } from '@/utils/system.js'
import { apiUserInfo } from '@/api/apis';

const userInfo = ref({})

const listTop = ref([
	{id: 1, name: '我的下载', imgPath:'download-filled', tag: 0},
	{id: 2, name: '我的评分', imgPath:'star-filled', tag: 0},
	{id: 3, name: '联系客服', imgPath:'chatboxes-filled', tag: 0}
])
const listButtom = ref([
	{id: 1, name: '订阅更新', imgPath:'notification-filled', tag: 0},
	{id: 2, name: '常见问题', imgPath:'flag-filled', tag: 0},
])

const clickContact = () => {
	uni.makePhoneCall({
	  phoneNumber: "114"
	})
}
const getUserInfo = () => {
	apiUserInfo().then(res => {
		userInfo.value = res.data
		console.log(res)
	})
}

</script>

<style lang="scss">
.userLayout{
	.userInfo{
		display: flex;
		align-items: center;
		justify-content: center;
		//垂直布局
		flex-direction: column;
		padding: 50rpx 0;
		.avatar{
			width: 160rpx;
			height: 160rpx;
			border-radius: 50%;
			//不添加切不到圆角
			overflow: hidden;
			image{
				width: 100%;
				height: 100%;
			}
		}
		
		.ip{
			font-size: 44rpx;
			color: #333;
			padding: 20rpx 0 5rpx;
		}
		
		.address{
			font-size: 28rpx;
			color: #aaa;
		}
			
	}
	
	.section{
		width: 690rpx;
		margin: 50rpx auto;
		//边框
		border: 1px solid #eee;
		//圆角
		border-radius: 10rpx;
		//阴影
		box-shadow: 0 0 30rpx rgba(0,0,0,0.05);
		
		.list{
			.row{
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding: 0 30rpx;
				height: 100rpx;
				//每一个之间的横线
				border-bottom: 1px solid #eee;
				//最后一个横线重复
				&:last-child{border-bottom: 0;}
				position: relative;
				
				background: #fff;
				
				.left{
					display: flex;
					align-items: center;
					.text{
						padding-left: 20rpx;
						font-size: 30rpx;
						color: #666;
					}
				}
				
				.right{
					display: flex;
					align-items: center;
					.text{
						padding-left: 20rpx;
						font-size: 28rpx;
						color: #aaa;
					}
				}
				
				button{
					position: absolute;
					top: 0;
					left: 0;
					height: 100rpx;
					width: 100%;
					opacity: 0;
				}
				
			}
		}
	}
}
</style>
